package tech.ezrealc.fall2023.service.affair.department;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.ezrealc.fall2023.model.affair.department.DepartmentDTO;
import tech.ezrealc.fall2023.model.affair.department.mapper.DepartmentMapper;
import tech.ezrealc.fall2023.repository.affair.department.DepartmentRepository;

import java.util.List;

@Service
@Transactional
public class DepartmentService {

    @Resource
    private DepartmentRepository departmentRepository;

    @Resource
    private DepartmentMapper departmentMapper;

    public List<DepartmentDTO> queryAll() {
        return departmentMapper.toDTOList(departmentRepository.selectAll());
    }

}
